home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / BIOSKEY.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  403 b   |  22 lines

  1. /* bioskey.c --- p568 */
  2. #include <stdio.h>
  3. #include <bios.h>
  4. #define KEYBRD_READY    1
  5. #define KEYBRD_READ    0
  6. main()
  7. {
  8.     unsigned count = 0, c = 0;
  9.     while(count < 5000)
  10.     {
  11.         if(bioskey(KEYBRD_READY))
  12.         {
  13.                 /* read keystroke & mask out high byte */
  14.             c = bioskey(KEYBRD_READ) & 0xff;
  15.             printf("You entered: %c\n", c);
  16.             break;
  17.         }
  18.         count++;
  19.     }
  20.     printf("Count is: %u\n", count);
  21. }
  22.